package com.demo.spring.test.bean;

import com.demo.spring.beans.factory.FactoryBean;

import java.lang.reflect.Proxy;

public class HusbandParent implements FactoryBean<IParent> {

    @Override
    public IParent getObject() throws Exception {
        return (IParent) Proxy.newProxyInstance(
                Thread.currentThread().getContextClassLoader(),
                new Class[]{IParent.class},
                (proxy, method, args) -> "父母帮忙代理" + method.getName()
        );
    }

    @Override
    public Class<?> getObjectType() {
        return IParent.class;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }

}
